home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / CGI::Fast.Z / CGI::Fast
Encoding:
Text File  |  1998-10-28  |  6.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4.      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       CGI::Fast - CGI Interface for    Fast CGI
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           use CGI::Fast qw(:standard);
  13.           $COUNTER = 0;
  14.           while (new CGI::Fast) {
  15.           print    header;
  16.           print    start_html("Fast CGI Rocks");
  17.           print
  18.               h1("Fast CGI Rocks"),
  19.               "Invocation number ",b($COUNTER++),
  20.               "    PID ",b($$),".",
  21.               hr;
  22.           print    end_html;
  23.           }
  24.  
  25.  
  26.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  27.       CGI::Fast is a subclass of the CGI object created by CGI.pm.
  28.       It is    specialized to work well with the Open Market FastCGI
  29.       standard, which greatly speeds up CGI    scripts    by turning
  30.       them into persistently running server    processes.  Scripts
  31.       that perform time-consuming initialization processes,    such
  32.       as loading large modules or opening persistent database
  33.       connections, will see    large performance improvements.
  34.  
  35.      OOOOTTTTHHHHEEEERRRR PPPPIIIIEEEECCCCEEEESSSS OOOOFFFF TTTTHHHHEEEE PPPPUUUUZZZZZZZZLLLLEEEE
  36.       In order to use CGI::Fast you'll need    a FastCGI-enabled Web
  37.       server.  Open    Market's server    is FastCGI-savvy.  There are
  38.       also freely redistributable FastCGI modules for NCSA httpd
  39.       1.5 and Apache.  FastCGI-enabling modules for    Microsoft
  40.       Internet Information Server and Netscape Communications
  41.       Server have been announced.
  42.  
  43.       In addition, you'll need a version of    the Perl interpreter
  44.       that has been    linked with the    FastCGI    I/O library.
  45.       Precompiled binaries are available for several platforms,
  46.       including DEC    Alpha, HP-UX and SPARC/Solaris,    or you can
  47.       rebuild Perl from source with    patches    provided in the
  48.       FastCGI developer's kit.  The    FastCGI    Perl interpreter can
  49.       be used in place of your normal Perl without ill
  50.       consequences.
  51.  
  52.       You can find FastCGI modules for Apache and NCSA httpd,
  53.       precompiled Perl interpreters, and the FastCGI developer's
  54.       kit all at URL:
  55.  
  56.         http://www.fastcgi.com/
  57.  
  58.  
  59.      WWWWRRRRIIIITTTTIIIINNNNGGGG FFFFAAAASSSSTTTTCCCCGGGGIIII PPPPEEEERRRRLLLL SSSSCCCCRRRRIIIIPPPPTTTTSSSS
  60.  
  61.  
  62.  
  63.      PPPPaaaaggggeeee 1111                        ((((pppprrrriiiinnnntttteeeedddd 11110000////22223333////99998888))))
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))
  71.  
  72.  
  73.  
  74.       FastCGI scripts are persistent: one or more copies of    the
  75.       script are started up    when the server    initializes, and stay
  76.       around until the server exits    or they    die a natural death.
  77.       After    performing whatever one-time initialization it needs,
  78.       the script enters a loop waiting for incoming    connections,
  79.       processing the request, and waiting some more.
  80.  
  81.       A typical FastCGI script will    look like this:
  82.  
  83.           #!/usr/local/bin/perl    # must be a FastCGI version of perl!
  84.           use CGI::Fast;
  85.           &do_some_initialization();
  86.           while ($q    = new CGI::Fast) {
  87.           &process_request($q);
  88.           }
  89.  
  90.       Each time there's a new request, CGI::Fast returns a CGI
  91.       object to your loop.    The rest of the    time your script waits
  92.       in the call to _n_e_w().     When the server requests that your
  93.       script be terminated,    _n_e_w() will return undef.  You can of
  94.       course exit earlier if you choose.  A    new version of the
  95.       script will be respawned to take its place (this may be
  96.       necessary in order to    avoid Perl memory leaks    in long-
  97.       running scripts).
  98.  
  99.       CGI.pm's default CGI object mode also    works.    Just modify
  100.       the loop this    way:
  101.  
  102.           while (new CGI::Fast) {
  103.           &process_request;
  104.           }
  105.  
  106.       Calls    to _h_e_a_d_e_r(), _s_t_a_r_t__f_o_r_m(), etc.    will all operate on
  107.       the current request.
  108.  
  109.      IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG    FFFFAAAASSSSTTTTCCCCGGGGIIII    SSSSCCCCRRRRIIIIPPPPTTTTSSSS
  110.       See the FastCGI developer's kit documentation    for full
  111.       details.  On the Apache server, the following    line must be
  112.       added    to srm.conf:
  113.  
  114.           AddType application/x-httpd-fcgi .fcgi
  115.  
  116.       FastCGI scripts must end in the extension .fcgi.  For    each
  117.       script you install, you must add something like the
  118.       following to srm.conf:
  119.  
  120.          AppClass /usr/etc/httpd/fcgi-bin/file_upload.fcgi -processes 2
  121.  
  122.       This instructs Apache    to launch two copies of
  123.       file_upload.fcgi at startup time.
  124.  
  125.      UUUUSSSSIIIINNNNGGGG FFFFAAAASSSSTTTTCCCCGGGGIIII SSSSCCCCRRRRIIIIPPPPTTTTSSSS AAAASSSS CCCCGGGGIIII SSSSCCCCRRRRIIIIPPPPTTTTSSSS
  126.  
  127.  
  128.  
  129.      PPPPaaaaggggeeee 2222                        ((((pppprrrriiiinnnntttteeeedddd 11110000////22223333////99998888))))
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      CCCCGGGGIIII::::::::FFFFaaaasssstttt((((3333))))
  137.  
  138.  
  139.  
  140.       Any script that works    correctly as a FastCGI script will
  141.       also work correctly when installed as    a vanilla CGI script.
  142.       However it will not see any performance benefit.
  143.  
  144.      CCCCAAAAVVVVEEEEAAAATTTTSSSS
  145.       I haven't tested this    very much.
  146.  
  147.      AAAAUUUUTTTTHHHHOOOORRRR IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  148.       be used and modified freely, but I do    request    that this
  149.       copyright notice remain attached to the file.     You may
  150.       modify this module as    you wish, but if you redistribute a
  151.       modified version, please attach a note listing the
  152.       modifications    you have made.
  153.  
  154.       Address bug reports and comments to:
  155.       lstein@genome.wi.mit.edu
  156.  
  157.      BBBBUUUUGGGGSSSS
  158.       This section intentionally left blank.
  159.  
  160.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  161.       the _C_G_I::_C_a_r_p    manpage, the _C_G_I manpage
  162.  
  163.       =cut
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.